package org.clweb.filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author dakhoa
 * @version 1.0
 */
public class CLWebFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest httpReg = (HttpServletRequest) request;

        ConversationManager manager = ConversationManager.currentInstance(httpReg);

        if (manager.isSignalEndFlow()) {
            return;
        }

        chain.doFilter(request, response);
        return;
    }

    public void destroy() {
    }
}
